package com.tg.app.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.tange.base.toolkit.DimenUtil;
import com.tg.app.R;

public class CameraPlayerPiPSwapVerticalView extends CameraPlayerPiPVerticalView {

    public CameraPlayerPiPSwapVerticalView(@NonNull Context context) {
        super(context);
    }

    public CameraPlayerPiPSwapVerticalView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public CameraPlayerPiPSwapVerticalView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    @Override
    protected int getLayoutID() {
        return R.layout.layout_camera_player_pip_vertical_swap;
    }

    @Override
    public ConstraintLayout.LayoutParams getMainLayoutParams(){
        ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.startToStart = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.bottomToBottom = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.topToBottom = R.id.player_view_pip_vertical_mini;
        return layoutParams;
    }


    @Override
    public ConstraintLayout.LayoutParams getMiniLayoutParams(){
        ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.startToStart = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.endToEnd = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID;
        layoutParams.bottomToTop = R.id.player_view_pip_vertical_main;
        layoutParams.bottomMargin = DimenUtil.dp2px(mContext, 1);
        return layoutParams;
    }


    @Override
    public RelativeLayout.LayoutParams getMainTextureLayoutParams(int width, int height){
        RelativeLayout.LayoutParams mainParams = new RelativeLayout.LayoutParams(width, height);
        mainParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
        mainParams.topMargin = DimenUtil.dp2px(mContext, 1);
        return mainParams;
    }


    @Override
    public RelativeLayout.LayoutParams getMiniTextureLayoutParams(int width, int height){
        RelativeLayout.LayoutParams minParams = new RelativeLayout.LayoutParams(width, height);
        minParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        return minParams;
    }

}
